package com.example.ivos.audit.controller;

import com.example.ivos.audit.pojo.dto.AuditParam;
import com.example.ivos.audit.pojo.dto.AuditQuery;
import com.example.ivos.audit.pojo.vo.AuditVO;
import com.example.ivos.audit.service.AuditService;
import com.example.ivos.base.response.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "审核模块")
@RestController
@Slf4j
@RequestMapping("/v1/audit/")
public class AuditController {

    @Autowired
    private AuditService auditService;

    @ApiOperation("查询审核单")
    @GetMapping("select")
    public JsonResult select(AuditQuery auditQuery){
        log.debug("查询审核单auditQuery:{}", auditQuery);
        List<AuditVO> auditList=auditService.selectAudit(auditQuery);
        return JsonResult.ok(auditList);
    }

    @ApiOperation("审批申请")
    @PostMapping("update")
    public JsonResult update(AuditParam auditParam){
        log.debug("审批申请auditParam:{}", auditParam);
        auditService.update(auditParam);
        return JsonResult.ok();
    }
}
